package com.authsphere.security.account.api.lock;

import org.apache.commons.lang3.tuple.Pair;

import java.util.List;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/14 09:16
 **/
public interface AccountLockoutService {

    /**
     * account lockout
     *
     * @param username account
     * @return LockedAccount
     */
    LockedAccount lockout(String username);

    /**
     * account unlock
     * @param username account
     */
    void unlock(String username);

    /**
     * is locked
     * @param username account
     * @return boolean
     */
    boolean isLocked(String username);

    /**
     * get locked time
     * @param username account
     * @return locked time
     */
    int getLockedTime(String username);

    /**
     * reset attempt count
     * @param username account
     */
    void resetAttemptCount(String username);

    /**
     * get locked accounts
     * @param username account
     * @return locked accounts
     */
    List<LockedAccount> getLockedAccounts(String username);

    /**
     * page locked accounts
     * @param offset offset
     * @param limit limit
     * @param username username
     * @return
     */
    Pair<Long, List<LockedAccount>> pageLockedAccounts(int offset, int limit, String username);
}
